package com.base.app_core.View;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;

import com.base.app_core.R;
import com.base.app_core.util.XYBAUtils;


/**
 * Created by xiangheng.song on 2017/3/10.
 */

public class LinkImageView extends ImageView implements View.OnClickListener {

    private String url;

    public LinkImageView(Context context, AttributeSet attrs){
        super(context, attrs);
        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.LinkView);
        this.url = a.getString(R.styleable.LinkView_url);
        a.recycle();
        setOnClickListener(this);
    }

    public void setUrl(String url) {

        this.url= XYBAUtils.paraseURL(url);
    }

    @Override
    public void onClick(View v) {
        XYBAUtils.gotoURL(url);

    }
}
